<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/internal.xhtml">
	<ui:define name="center">
		<script type="text/javascript">
			$( document ).ready(function() {
				wlayout.layout.hide('south');
				wlayout.layout.open('west');
			});	
			function positionOnClick(elm){
				var pos =$(PrimeFaces.escapeClientId(elm.source)).position();
				wmodalExerciseGroupView.getJQ().css({'left':pos.left, 'top':pos.top});
			};
		</script>
		<p:outputPanel id="content" layout="block" style="height:100%;width:100%">
			<ui:include src="/exerciseGroup/exerciseGroupForm.xhtml"/> 
		</p:outputPanel>
	</ui:define>
	<ui:define name="menu">
		<h:form id="listExerciseGroupForm" prependId="false">
			<p:dataTable id="exerciseGroupsTable" value="#{exerciseGroupBean.versionableExerciseGroups }" var="versionableExerciseGroup" paginator="true"  paginatorAlwaysVisible="false"  paginatorPosition="bottom" rows="15" emptyMessage="#{msgs.NoResults}">
				<p:columnGroup type="header">  
					<p:row>
						<p:column colspan="4">
							<f:facet name="header">
								<h:outputText value="#{msgs.ExerciseGroups}" />
							</f:facet>
						</p:column>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Filter}" icon="ui-icon-search" onclick="wfindExerciseGroup.show()" styleClass="ui-table-button"/>
							</f:facet>
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Add}"	action="#{exerciseGroupBean.toAddExerciseGroup}" update=":content"	 icon="ui-icon-plus" styleClass="ui-table-button"/>
							</f:facet>
						</p:column>
						<p:column	colspan="2">
							<f:facet name="header">
								<h:outputText value="#{msgs.Name}"/>
							</f:facet>
						</p:column>
						<p:column colspan="2" style="max-width:12px"	 >
							<f:facet name="header">
								<h:outputText value="#{msgs.Version}"/>
							</f:facet>
						</p:column>
					</p:row>	
				</p:columnGroup>

				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row"  >
					<p:commandButton title="#{msgs.Edit}" action="#{exerciseGroupBean.toViewExerciseGroup}"  icon="ui-icon-pencil"  styleClass="ui-table-button" update=":content">
						<f:setPropertyActionListener target="#{exerciseGroupBean.versionableExerciseGroup}" value="#{versionableExerciseGroup}"/>
					</p:commandButton>
				</p:column>
				
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row"  >
					<p:commandButton title="#{msgs.View}" icon="ui-icon-search" update=":modalExerciseGroupView"  oncomplete="wmodalExerciseGroupView.show();positionOnClick(this);"  
						styleClass="ui-table-button" >
						<f:setPropertyActionListener target="#{exerciseGroupBean.selVersionableExerciseGroup}" value="#{versionableExerciseGroup}"/> 
					</p:commandButton>	
				</p:column>

				<p:column colspan="1" headerText="#{msgs.Name}" >
					<h:outputText value="#{versionableExerciseGroup.exerciseGroup.name} " />
				</p:column> 

				<p:column colspan="1" style="padding:1px;max-width:30px"  >
					<p:selectOneMenu value="#{versionableExerciseGroup.exerciseGroup}" converter="#{genericConverter}"  style="white-space: nowrap;"  
						panelStyle="max-width:30px;"	styleClass="ui-selector-on-table"  >
						<f:selectItems value="#{versionableExerciseGroup.exerciseGroupVersions}" var="exerciseGroupVersion"  
							itemLabel="#{exerciseGroupVersion.version}" itemValue="#{exerciseGroupVersion}"/>
						<p:ajax  update=":listExerciseGroupForm:exerciseGroupsTable" />
					</p:selectOneMenu>
				</p:column>
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row" >
					<p:commandButton title="#{msgs.Delete}" process="@this" onclick="wconfExcExerciseGroup.show();"  icon="ui-icon-trash" styleClass="ui-table-button" >
						<f:setPropertyActionListener target="#{exerciseGroupBean.versionableExerciseGroup}" value="#{versionableExerciseGroup}"/> 
					</p:commandButton>
				</p:column>		
			</p:dataTable>			
		</h:form>
	</ui:define>

	<ui:define name="tools">

	</ui:define>

	<ui:define name="dialogs">
		<ui:include src="/exerciseGroup/exerciseGroupDialogs.xhtml"/>
	</ui:define>
</ui:composition>
	
</html>